<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"
	import="app.engine.solucoes.request.beans.*,java.util.*"%>
<jsp:useBean id="usuario" class="app.engine.solucoes.request.beans.Usuario" scope="session" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<script type="text/javascript" src="/javascript/script.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=usuario.getNomeUsuario() != null ? usuario.getNomeUsuario() : ""%> - [Pesquisar FAQ]</title>
</head>
<body onload="tringTextArea();">
<%
	if (usuario.getId() == null && usuario.getEhModerador())
		response.sendRedirect("/");
%>
<% List<Pergunta> perguntas  = (List<Pergunta>) request.getAttribute("perguntas"); %>
<form name="menu" action="faqtool" method="post">
<input type="hidden" name="cmd" value="" />
<input type="hidden" name="idPergunta" value="" />
<table border="0" align="center">
	<tr>
		<td>
			<table>
				<tr>
					<td><textarea id="pergunta" name="txtPergunta" cols="35" rows="5">
						<%=request.getAttribute("txtPergunta") != null ? request.getAttribute("txtPergunta") : "" %>
						</textarea></td>
				</tr>
				<tr>
					<td align="center">
						<input type="submit" value="Voltar" onClick="document.menu.cmd.value='main-menu'" />
						<input type="submit" value="Pesquisar" onClick="document.menu.cmd.value='do-list-faq'" />
					</td>
				</tr>
	        </table>
		</td>
	</tr>
</table>
<table border="0" align="center">
	<tr>
		<td>
			<table>
		        <% if (perguntas != null && !perguntas.isEmpty()) { %>
				
					<% for(Pergunta pergunta : perguntas) { %>
						<tr>
							<td width="600px" align="center">
								<a href="faqtool?idPergunta=<%=pergunta.getId() %>&cmd=view-question&txtPergunta=<%=request.getAttribute("txtPergunta") %>" >
								   <font color="blue"><%=pergunta.getTxtPergunta() %></font></a><br />
							</td>
						</tr>
					<% } %>
				<%} %>
		
				<% if (request.getAttribute("faqtool.msg") != null) { %>
					<tr>
						<td colspan="2" bgcolor="white">
							<font size="-1" color="<%=request.getAttribute("corFonte") != null ? request.getAttribute("corFonte") : "black"%>">
								<i><%=request.getAttribute("faqtool.msg")%></i>
							</font>
						</td>
					</tr>
				<%} %>
			</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>